package utils
{
	import core.Global;
	
	import flash.display.Sprite;
	
	import interfaces.IAction;

	public class ActionFactory
	{
		public function ActionFactory()
		{
		}
		
		public function makeAction(name:String = null):Sprite
		{
			var action:IAction = createAction(name);
			Global.addAction(action);
			if(name)Sprite(action).name = name;
			return Sprite(action);
		}
		
		protected function createAction(name:String = null):IAction
		{
			// 工厂方法必须被重写
			return null; 
		}
	}
}